//new javax.swing.JButton(CargadorImagenes.crearIconoPath(path+"c1.png"));
/*
 *
 * Created on 14 de febrero de 2006, 06:28 PM
 */
package ig.formato.gui.run;

//import com.sun.swing.internal.plaf.basic.resources.basic;
import ig.formato.gui.app.DConfiguracion;
import ig.formato.gui.app.PPlantilla;
import ig.formato.gui.app.PReporte;
import ig.formato.gui.app.PSGDB;
import ig.basic.util.IMetodosPantallas;
import ig.formato.basic.ManipulacionDatos;
import ig.formato.gui.app.DAbaut;
import ig.formato.gui.app.PConexion;
import ig.formato.gui.app.PEntidad;
import ig.formato.gui.app.herramientas.IQuery;
import ig.formato.util.IGFormatoException;
import ig.formato.util.LoadProperties;
import ig.formato.util.MasterConnection;
import ig.formato.util.MiRendererTree;
import java.beans.PropertyVetoException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.Hashtable;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

/**
 *z
 * @author  jsanchez
 */
public class PrincipalIGFormato extends javax.swing.JFrame {

    private String[] treelabels = {"<IG-Formato>", "Configuracion", /*"Entidad","Mercado","Reportes","Modelos",*/ "Salidas"/*,"Usuario"*/};
    private String[] ConfiguracionItems = {"Configuracion", "Gestores de Base de Datos", "Fuentes de Datos", "Datos Basicos de la Entidad"/*, "Formatos Tipos de datos"*/, "Informes"/*,"Emisores Cargados"/*,"PDFViewer"/*,"Matriz de Correlación"*/};
    private String[] SalidasItems = {"Salidas", "Generador de Informes"/*,"Swing Browser","PDFViewer","JasperViewer","Admin Modelo"*/};
    private DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[treelabels.length];
    private Object[] ConfiguracionNodes = new Object[ConfiguracionItems.length + 3];
    private Object[] SalidasNodes = new Object[SalidasItems.length];
    private Object[][] OBJECT = new Object[treelabels.length][2];
    int subAdd = -1;
    public boolean start = true;
    private JInternalFrame salidas = null;
    public static PrincipalIGFormato frame = null;
//    private Process pro2 = null;
//    private Process pro1 = null;

    public Hashtable<String, Object> getSession() {
        return null;
    }

    public PrincipalIGFormato(String iconTree) {
        cargarOpcionesTree();
        initComponents();        
        setSize(1024, 730);
        setTitle(LoadProperties.getProperties("conf/igformato.properties", "version"));
        setIconImage(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/ig-formato.gif")).getImage());
        this.setLocationByPlatform(true);
        Tre_Opciones.setCellRenderer(new MiRendererTree(iconTree));
        Tre_Opciones.requestFocusInWindow();
        //centrar();
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
        MSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MSalirActionPerformed(evt);
            }});
        for (int i = 0; i < this.Tre_Opciones.getRowCount(); i++) {
            this.Tre_Opciones.expandRow(i);
        }
        jMenuItem1.setVisible(false);
        jMenuItem2.setVisible(false);
        //setVisible(true);
    }

    private void setRelacionarNodos(Object[] padre, String[] ItemsHijo) {
        subAdd++;
        OBJECT[subAdd][0] = padre;
        OBJECT[subAdd][1] = ItemsHijo;
    }

    private void cargarOpcionesTree() {
        setRelacionarNodos(ConfiguracionNodes, ConfiguracionItems);
        setRelacionarNodos(SalidasNodes, SalidasItems);

        for (int i = 0; i <= subAdd + 1; i++) {
            nodes[i] = new DefaultMutableTreeNode(treelabels[i]);
        }
        int k = 1;
        int m = 1;
        for (int i = 0; i <= subAdd; i++) {
            String[] ItemsDM = (String[]) OBJECT[i][1];
            for (int j = 1; j < ItemsDM.length; j++) {
                DefaultMutableTreeNode opcion = new DefaultMutableTreeNode(ItemsDM[j]);
                nodes[k].add(opcion);
            }
            for (int l = 1; l <= subAdd + 1; l++) {
                if (ItemsDM[0].equals(nodes[l].getUserObject())) {
                    m = l;
                }
            }
            if (m != k) {
                nodes[m].add(nodes[k]);
            }
            k++;
        }
        nodes[0].add(nodes[1]);//adiciona el menu Confuguracion
        nodes[0].add(nodes[2]);//ediciona el menu Salidas
    }

    public void validarEvento() {
        setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
        try {
            if (Tre_Opciones.getLastSelectedPathComponent()!=null && Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems[1])) {
                JInternalFrame in = new PSGDB(this).getInternalFrame();
                in.setTitle(ConfiguracionItems[1]);
                in.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
                addComponente(in);
            } else if (Tre_Opciones.getLastSelectedPathComponent()!=null && Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems[2])) {
                JInternalFrame in = new PConexion(this).getInternalFrame();
                in.setTitle(ConfiguracionItems[2]);
                in.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
                addComponente(in);
            } else if (Tre_Opciones.getLastSelectedPathComponent()!=null && Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems[3])) {
                JInternalFrame in = new PEntidad(this).getInternalFrame();
                in.setTitle(ConfiguracionItems[3]);
                in.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
                addComponente(in);
            /*} else if (Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems[4])) {
            JInternalFrame in = new PParametros(this).getInternalFrame();
            in.setTitle(ConfiguracionItems[4]);
            in.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
            addComponente(in);*/
            } else if (Tre_Opciones.getLastSelectedPathComponent()!=null && Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems[4])) {
                JInternalFrame in = new PPlantilla(this).getInternalFrame();
                in.setTitle(ConfiguracionItems[4]);
                in.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
                addComponente(in);
            //            }else if (Tre_Opciones.getLastSelectedPathComponent().toString().equals(ConfiguracionItems [5])){
//                JInternalFrame in =new PEmisores(this).getInternalFrame();
////                JInternalFrame in =new PConexionN(this).getInternalFrame();
//                in.setTitle(ConfiguracionItems[5]);
//                addComponente(in);
            } else if (start || (Tre_Opciones.getLastSelectedPathComponent()!=null && Tre_Opciones.getLastSelectedPathComponent().toString().equals(SalidasItems[1]))) {
                if( salidas == null ){
                    salidas = new JInternalFrame(SalidasItems[1], true, true, true, true);
                    salidas.getContentPane().add(new PReporte(this));
                    salidas.setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/item.gif")));
                    salidas.setSize(800, 610);
                }
                try{
                    tpMenu.setSelectedIndex(1);
                }catch(Exception e){}                
                addComponente(salidas);
                start = false;
            //            }else if (Tre_Opciones.getLastSelectedPathComponent().toString().equals(SalidasItems [2])){
//                String URL="http://"+host+":"+puertoHttp+"/ServicioReportes/GenerarReporte.all";
//                String sep=System.getProperties().getProperty("file.separator");
//                String PF="C:"+sep+"Program Files";
//                String AP="C:"+sep+"Archivos de programa";
//                try {
//                    //showHtmlViewer(URL);
//                    pro2 = Runtime.getRuntime().exec(PF+sep+"Internet Explorer"+sep+"IEXPLORE.EXE "+URL);
//                } catch (Exception e1){
//                    try {
//                        pro2 = Runtime.getRuntime().exec(AP+sep+"Internet Explorer"+sep+"IEXPLORE.EXE "+URL);
//                    } catch (Exception e) {
//                        pro2 = Runtime.getRuntime().exec("firefox "+URL);
//                    }
//                }
            }
        } catch (Exception ex) {
            if (ex != null && ex.getMessage() != null && ex.getMessage().trim().length() > 0) {
                JOptionPane.showMessageDialog(contenedor, ex.toString(), "Mensaje", JOptionPane.OK_OPTION);
            }
            ex.printStackTrace();
        }finally{
            Tre_Opciones.clearSelection();
        }
        //Lab_Proceso.setText("Finalizado");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    }

    public static void main(String args[]) {
        System.out.println(UIManager.getSystemLookAndFeelClassName());
        System.out.println("OS:" + System.getProperties().get("os.name"));
        String iconTree = "tree";
        String param = null;
        if (args.length > 0) {
            param = args[0];
        }

        if (param != null && !param.equals("")) {
            try {
                if (param.equals("-1")) {
                    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                } else if (param.equals("0")) {
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    JDialog.setDefaultLookAndFeelDecorated(true);
                } else if (param.equals("1")) {
                    UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel");
                } else if (param.equals("2")) {
                    UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
                } else if (param.equals("3")) {
                    UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticLookAndFeel");
                } else if (param.equals("4")) {
                    UIManager.setLookAndFeel("com.jgoodies.plaf.windows.ExtWindowsLookAndFeel");
                } else if (param.equals("5")) {
                    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
                } else if (param.equals("6")) {
                    UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
                } else if (param.equals("7")) {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                }
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            } catch (InstantiationException ex) {
                ex.printStackTrace();
            } catch (UnsupportedLookAndFeelException ex) {
                ex.printStackTrace();
            } catch (IllegalAccessException ex) {
                ex.printStackTrace();
            }
        }
        frame = new PrincipalIGFormato(iconTree);
        frame.setVisible(true);
    }

    //    public void setLogin(LoginDTO login) {
//        String Key=getUser();
//        Long ID=(Long) getSession().get(Key);
//        Long ROL=(Long) getSession().get("ROL");
//        login.setID(ID);
//        login.setUSUARIO(Key);
//        login.setROL(ROL);
//    }
    void desconectar() {
        //        mLogin =new MLogin(this,null);
//        mLogin.desconectar(this.session);
//        this.session= new Hashtable<String,Object>();
//        this.Button_Salir.setIcon(new javax.swing.ImageIcon(getClass().getResource("//ig/formato/util/images/c1.png")));
//      this.Button_Salir.setIcon(CargadorImagenes.crearIconoPath(path+"c1.png"));
        this.Tre_Opciones.setEnabled(false);
        JInternalFrame[] ventanas = this.contenedor.getAllFrames();
        for (int i = 0; i < ventanas.length; i++) {
            ventanas[i].dispose();
        }
    }

    void conectar() {
    }

    void salir() {
        if (JOptionPane.showConfirmDialog(this, "Salir de IG Formato", "Mensaje", JOptionPane.OK_CANCEL_OPTION) == 0) {
            //killerProcess();
            clossing();
            closeConnection();
            System.exit(-1);
        }
    }

    void conectado() {
        this.Tre_Opciones.setEnabled(true);
    }

    public void centrar() {
        java.awt.Dimension dimensionScreen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Rectangle dimensionPantalla = getBounds();
        setLocation((dimensionScreen.width - dimensionPantalla.width) / 2, (dimensionScreen.height - dimensionPantalla.height) / 2);
    }

    public void closeConnection() {
        try {
            MasterConnection.getMasterConnection().getConnection().rollback();
        } catch (Exception e) {
            System.out.println("Erorr rollback");
        //            e.printStackTrace();
        }
        MasterConnection.getMasterConnection().closeConnectionMaster();
    }

    void clossing() {

        for (int i = 0; i < contenedor.getAllFrames().length; i++) {

            if (contenedor.getAllFrames()[i] instanceof ManipulacionDatos) {
                try {
                    ((IMetodosPantallas) ((ManipulacionDatos) contenedor.getComponents()[i]).getPanelMetodosPantalla()).salir();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else if (contenedor.getAllFrames()[i].getContentPane().getComponents()[0] instanceof IMetodosPantallas) {
                try {
                    ((IMetodosPantallas) contenedor.getAllFrames()[i].getContentPane().getComponents()[0]).salir();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
        this.desconectar();
    }

    /*private void killerProcess() {
    if (pro2 != null) {
    pro2.destroy();
    pro2 = null;
    }
    if (pro1 != null) {
    pro1.destroy();
    pro1 = null;
    }
    }*/
    public void setJInternalPanel(JInternalFrame in) {
        in.setVisible(true);
        contenedor.add(in);
        try {
            in.setSelected(true);
        } catch (PropertyVetoException ex) {
            ex.printStackTrace();
        }
    }

    public void addComponente(JInternalFrame in) throws PropertyVetoException {
        boolean addPantallaContenedor = true;

        java.awt.Rectangle dimensionScreen = contenedor.getBounds();
        java.awt.Rectangle dimensionPantalla = in.getBounds();
        in.setLocation((dimensionScreen.width - dimensionPantalla.width) / 2, (dimensionScreen.height - dimensionPantalla.height) / 2);

        for (int i = 0; i < contenedor.getAllFrames().length; i++) {
            if (contenedor.getAllFrames()[i].getTitle().equals(in.getTitle())) {
                contenedor.getAllFrames()[i].setSelected(true);
                addPantallaContenedor = false;
            }
        }
        if (addPantallaContenedor) {
            contenedor.add(in);
            in.setVisible(true);
            in.setSelected(true);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jSplitPane1 = new javax.swing.JSplitPane();
        contenedor = new javax.swing.JDesktopPane();
        lIg = new javax.swing.JLabel();
        tpMenu = new javax.swing.JTabbedPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        DefaultTreeModel model=new DefaultTreeModel(nodes[0]);
        Tre_Opciones = new javax.swing.JTree(model);
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenu1 = new javax.swing.JMenu();
        MIConfiguracio = new javax.swing.JMenuItem();
        MiQuery = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        MSalir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        AsercaDe = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jSplitPane1.setDividerLocation(191);
        jSplitPane1.setDividerSize(6);
        jSplitPane1.setAutoscrolls(true);
        jSplitPane1.setDoubleBuffered(true);
        jSplitPane1.setOneTouchExpandable(true);

        contenedor.setBackground(new java.awt.Color(255, 255, 255));
        contenedor.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        contenedor.setToolTipText("Panel de Trabajo");
        contenedor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                contenedorMouseClicked(evt);
            }
        });
        contenedor.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                contenedorComponentResized(evt);
            }
        });

        lIg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/ig.PNG"))); // NOI18N
        lIg.setBounds(10, 20, 120, 120);
        contenedor.add(lIg, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jSplitPane1.setRightComponent(contenedor);

        tpMenu.setBackground(new java.awt.Color(204, 255, 204));
        tpMenu.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        jScrollPane1.setToolTipText("opciones");

        Tre_Opciones.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
        Tre_Opciones.setToolTipText("Opciones");
        Tre_Opciones.setAutoscrolls(true);
        Tre_Opciones.setDoubleBuffered(true);
        Tre_Opciones.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTree1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(Tre_Opciones);

        tpMenu.addTab("Opciones", jScrollPane1);

        jSplitPane1.setLeftComponent(tpMenu);

        jMenuBar1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jMenuBar1.setForeground(new java.awt.Color(153, 153, 0));
        jMenuBar1.setPreferredSize(new java.awt.Dimension(133, 33));

        jMenu3.setBorder(null);
        jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/columnas.gif"))); // NOI18N
        jMenu3.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/columnas.gif"))); // NOI18N
        jMenuBar1.add(jMenu3);

        jMenu1.setText("Sistema");
        jMenu1.setDelay(10);
        jMenu1.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        jMenu1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jMenu1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        MIConfiguracio.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        MIConfiguracio.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        MIConfiguracio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ig/formato/util/images/consulta.gif"))); // NOI18N
        MIConfiguracio.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.Configuracion")); // NOI18N
        MIConfiguracio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MIConfiguracioActionPerformed(evt);
            }
        });
        jMenu1.add(MIConfiguracio);

        MiQuery.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        MiQuery.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        MiQuery.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.iQuery")); // NOI18N
        MiQuery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MiQueryActionPerformed(evt);
            }
        });
        jMenu1.add(MiQuery);
        jMenu1.add(jSeparator2);

        MSalir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        MSalir.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        MSalir.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.Salir")); // NOI18N
        jMenu1.add(MSalir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Ayuda");
        jMenu2.setDelay(10);
        jMenu2.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        jMenuItem1.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        jMenuItem1.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.muser")); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F12, 0));
        jMenuItem2.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        jMenuItem2.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.minsta")); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);
        jMenu2.add(jSeparator1);

        AsercaDe.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        AsercaDe.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
        AsercaDe.setText(org.openide.util.NbBundle.getMessage(PrincipalIGFormato.class, "Menu.acercade")); // NOI18N
        AsercaDe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AsercaDeActionPerformed(evt);
            }
        });
        jMenu2.add(AsercaDe);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 757, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void MIConfiguracioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MIConfiguracioActionPerformed
        try {
            new DConfiguracion(this, true);
        } catch (InvalidKeyException ex) {
            ex.printStackTrace();
        } catch (InvalidKeySpecException ex) {
            ex.printStackTrace();
        } catch (NoSuchAlgorithmException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_MIConfiguracioActionPerformed

    private void AsercaDeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AsercaDeActionPerformed
        new DAbaut(this, true);
    }//GEN-LAST:event_AsercaDeActionPerformed

    private void contenedorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_contenedorMouseClicked
    }//GEN-LAST:event_contenedorMouseClicked

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        salir();
    }//GEN-LAST:event_formWindowClosing

    private void jTree1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree1MouseClicked
        if (Tre_Opciones.getLastSelectedPathComponent() != null && ((DefaultMutableTreeNode) Tre_Opciones.getLastSelectedPathComponent()).isLeaf()) {
            //Lab_Proceso.setText(Tre_Opciones.getLastSelectedPathComponent().toString());
            if (evt.getClickCount() == 2 /*&& session.size()>0*/) {
                this.validarEvento();
            }
        }
    }//GEN-LAST:event_jTree1MouseClicked

private void MiQueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MiQueryActionPerformed
    try {
        addComponente(new IQuery());
    } catch (PropertyVetoException ex) {
        ex.printStackTrace();
    }
}//GEN-LAST:event_MiQueryActionPerformed

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
    // TODO add your handling code here:
    if(Boolean.valueOf(LoadProperties.getProperties("conf/igformato.properties", "startGenInf"))){
        validarEvento();
        tpMenu.addTab("Salidas", ((PReporte)salidas.getContentPane().getComponent(0)).pSelecciones );        
        tpMenu.setSelectedIndex(1);
    }
}//GEN-LAST:event_formWindowOpened

private void contenedorComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_contenedorComponentResized
    lIg.setLocation(contenedor.getWidth()-210, contenedor.getHeight()-125);
}//GEN-LAST:event_contenedorComponentResized

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
        try {
            if (!System.getProperties().get("os.name").toString().trim().equalsIgnoreCase("LINUX")) {
                Runtime.getRuntime().exec("cmd /c start Manual-Usuario[IG-Formato].pdf");
            } else {
                Runtime.getRuntime().exec("evince Manual-Usuario.pdf");
            }
        } catch (Exception ex) {
            ManipulacionDatos.showMensajeFrama(new IGFormatoException(ex, "No se pudo abrir el manual de Usuario", "Instale Acrobat"), this);
        }
    }

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
        try {
            if (!System.getProperties().get("os.name").toString().trim().equalsIgnoreCase("LINUX")) {
                Runtime.getRuntime().exec("cmd /c start Manual-Instalacion[IG-Formato].pdf");
            } else {
                Runtime.getRuntime().exec("evince Manual-Instalacion_[Aplicacion].pdf");
            }
        } catch (Exception ex) {
            ManipulacionDatos.showMensajeFrama(new IGFormatoException(ex, "No se pudo abrir el manual de Usuario", "Instale Acrobat"), this);
        }
    }

    private void MSalirActionPerformed(java.awt.event.ActionEvent evt) {
        this.salir();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem AsercaDe;
    private javax.swing.JMenuItem MIConfiguracio;
    private javax.swing.JMenuItem MSalir;
    private javax.swing.JMenuItem MiQuery;
    private javax.swing.JTree Tre_Opciones;
    private javax.swing.JDesktopPane contenedor;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JLabel lIg;
    private javax.swing.JTabbedPane tpMenu;
    // End of variables declaration//GEN-END:variables
}
